<!DOCTYPE html>
<html>

<head>

    {include file="common:meta"}

</head>
<style>
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">

                <div class="ibox-content">
                    <form method="" class="form-horizontal" id="form" action="">
                        <div class="hr-line-dashed"></div>
                        <div class="form-group has-success">
                            <label class="col-sm-2 control-label">*新密码</label>
                            <div class="col-sm-10">
                                <input type="number" name="password" value="" class="form-control" id="password">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group has-success">
                            <label class="col-sm-2 control-label">*确认密码
                            </label>
                            <div class="col-sm-10">
                                <input type="number"  name="repassword" class="form-control" value="" id="re-password">
                            </div>
                        </div>

                        <div class="col-sm-10">
                            <input type="hidden" name="user_id"  value="{$user_id}" class="form-control">
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group has-success">
                            <div class="col-sm-4 col-sm-offset-2">
                                <input class="btn btn-primary" id="btn-submit" type="button" value="提交">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="common:footer"}
<script>

    //同意修改
    var index = parent.layer.getFrameIndex(window.name);
    $('#btn-submit').click(function(){


        if($("#password").val()==''){

            $("#password").focus();
            layer.msg('请填写密码！',{
                time:1500
            });
            return false;
        }
        if($("#re-password").val()==''){
            $("#re-password").focus();
            layer.msg('请输入确认密码！',{
                time:1500
            });
            return false;
        }

        if($("#password").val() != $("#re-password").val()){
            layer.msg('密码不一致，请重新输入！',{
                time:1500
            });
            $("#re-password").focus();
            return false;
        }

        layer.confirm('确定重设密码吗？',{
            title:['提示','font-size:18px;font-family:楷体;font-weight:700;'],
            btn: ['确定','取消'] //按钮
        },function(){
            $.ajax({
                type:'get',
                url:'/UserResetPassword',
                async:true,
                data:$('#form').serialize(),
                dataType:'json',
                success:function(result){
                    if(result.code === 100){
                        //   parent.layer.close(index);//关闭当前页
                        layer.msg(result.msg,{
                            icon:1,
                            time:1000
                        });

                        //$('#tb_departments',parent.window.document).reload();
                        setTimeout(function () {
                            parent.layer.close(index);// 关闭layer
                        },1500);
                        //  window.parent.location.reload();
                        //window.parent.parent.location.replace(location.href);
                        //$('#tb_departments',parent.window.document).bootstrapTable(('refresh'));

                        // window.parent.location.replace(location.href)//刷新父级页面
//                        $('#tb_departments').bootstrapTable(('refresh'));
//                        $('#batch-deal-with').css('display','none');
                    }
                    else{
                        layer.msg(result.msg,{
                            icon:2,
                            time:1000
                        });
                    }
                },
                error:function(err){
                    layer.msg('服务器开小差了！',{
                        time:1500
                    });
                }
            });
        });
    });


    $("input:radio").click(function(){

        var number= $("#number-day").val();
        console.log(number);
        if(number != ''){
            layer.msg('你已经选择自定义天数！',{
                time:1500
            });
            return false;
        }

        var checkedState = $(this).attr('checked');//记录当前选中状态

        if(checkedState == 'checked'){
            $(this).attr('checked',false);
        }else{
            $(this).attr('checked',true);
        }
    });





</script>
</body>

</html>